#include "oeforgetpswdfromissuewidget.h"

#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDebug>

OEForgetPswdFromIssueWidget::OEForgetPswdFromIssueWidget(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout* layout = new QVBoxLayout();
    QHBoxLayout* layout_user = new QHBoxLayout();

    QLabel* lab_user = new QLabel(tr("用户账号:"));
    QLineEdit* edt_user = new QLineEdit();

    QPushButton* btn_next = new QPushButton(tr("下一步"));

    // 大小
    btn_next->setFixedSize(100,40);
    edt_user->setFixedSize(200,30);

    // 布局
    layout_user->addStretch(999);
    layout_user->addWidget(lab_user);
    layout_user->addSpacing(15);
    layout_user->addWidget(edt_user);
    layout_user->addStretch(999);
    layout->addStretch(999);
    layout->addLayout(layout_user);
    layout->addSpacing(20);
    layout->addWidget(btn_next, 0, Qt::AlignRight | Qt::AlignTop);
    layout->addStretch(999);

    setLayout(layout);

    connect(btn_next, &QPushButton::clicked,
            this, &OEForgetPswdFromIssueWidget::initIssuePage);
}

void OEForgetPswdFromIssueWidget::initIssuePage()
{
    QLayout* temp_layout = this->layout();

    while(QLayoutItem* item = temp_layout->takeAt(0)) {

        if (item) {
            temp_layout->removeItem(item);
            item->widget()->deleteLater();
        }
    }
    temp_layout->deleteLater();


//    QVBoxLayout* layout = new QVBoxLayout();
//    QHBoxLayout* layout_issue1 = new QHBoxLayout();




//    // 控件
//    QLabel* lab_logo = new QLabel();
//    QLabel* lab_logo_title = new QLabel(tr("找回密码"));


//    QLabel* lab_issue1 = new QLabel("");
//    QLabel* lab_issue1_info = new QLabel();
//    QLineEdit* edt_issue1 = new QLineEdit();

//    QLabel* lab_issue2 = new QLabel();
//    QLabel* lab_issue2_info = new QLabel();
//    QLineEdit* edt_issue2 = new QLineEdit();

//    QPushButton* btn_next = new QPushButton();

}
